package org.example.diet_compass.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import jakarta.annotation.Resource;
import org.example.diet_compass.domain.CommentLikes;
import org.example.diet_compass.mapper.CommentLikesMapper;
import org.example.diet_compass.service.CommentLikesService;
import org.springframework.stereotype.Service;

/**
* @author 86135
* @description 针对表【comment_likes(评论点赞表)】的数据库操作Service实现
* @createDate 2025-03-03 20:51:32
*/
@Service
public class CommentLikesServiceImpl extends ServiceImpl<CommentLikesMapper, CommentLikes>
    implements CommentLikesService {

    @Resource
    private CommentLikesMapper commentLikesMapper;

    @Override
    public void removeByUserIdAndCommentId(int userId, Long commentId) {
        commentLikesMapper.removeByUserIdAndCommentId(userId, commentId);
    }

    @Override
    public Integer getByUserIdAndCommentId(int userId, Long commentId) {
        int i = commentLikesMapper.getByUserIdAndCommentId(userId, commentId) == null ? 0 : 1;
        return i;
    }

}




